#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2021/7/24 10:58
# @Author  : LiShan
# @Email   : lishan_1997@126.com
# @File    : mean_time.py
# @Note    : this is note
import numpy as np

with open("no_interface_no_accelerate.txt", "r") as f:
    t = f.read().split("\n")
tt = []
for i in range(1, len(t)):
    if t[i] != "":
        print(t[i])
        tt.append(float(t[i]))
print(tt)
a = round(float(np.mean(tt)), 2)
print("无界面，无加速", a)

with open("no_interface_yes_accelerate.txt", "r") as f:
    t = f.read().split("\n")
tt = []
for i in range(1, len(t)):
    if t[i] != "":
        print(t[i])
        tt.append(float(t[i]))
print(tt)
b = round(float(np.mean(tt)), 2)
print("无界面，加速", b)

with open("yes_interface_no_accelerate.txt", "r") as f:
    t = f.read().split("\n")
tt = []
for i in range(1, len(t)):
    if t[i] != "":
        print(t[i])
        tt.append(float(t[i]))
print(tt)
c = round(float(np.mean(tt)), 2)
print("有界面，无加速", c)


with open("yes_interface_yes_accelerate.txt", "r") as f:
    t = f.read().split("\n")
tt = []
for i in range(1, len(t)):
    if t[i] != "":
        print(t[i])
        tt.append(float(t[i]))
print(tt)
d = round(float(np.mean(tt)), 2)
print("有界面，加速", d)


print("无界面情况下提升%.2f%%" % (round((a-b)/a*100, 2)))
print("有界面情况下提升%.2f%%" % (round((c-d)/c*100, 2)))
